<div class="right_side_operate_area">
    <div class="right_side_title left">
    </div>
    <div class="right item_add_btn">
        <?php 
            $str_title=__("Add",true);
            echo $html->link(__("Cancel",true).$str_title,"/users/index/");
        ?>
    </div>
    <div class="clear"></div>
</div>
<?php $cuser = $session->read('User'); ?>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <?php echo $form->create('User', array('url' => '/users/add','type'=> 'post','id' => 'addform','name' => 'form','enctype'=>'multipart/form-data','onsubmit' => "return addcheckinfo()") ); 
        ?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php echo "头像";?>：</div>
                <div class="form_right_e_input left"><input type="file" id="upload" name="upload[]" /></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Name")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.name',array("maxlength"=>"30"));?></div>
                <div id='namemessage' class="error_message"></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Email")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.email',array("maxlength"=>"50","style"=>"ime-mode:disabled"));?></div>
                <?php echo $form->text('User.uemail',array("class"=>"txthide","value"=>$form->value('User.email')));?>
                <div id='mailmessage' style='display:none;' class="error_message">请填写正确的邮箱地址！</div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Password")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.password',array("maxlength"=>"50","autocomplete"=>"off",'type' => 'password'));?></div>
                <div id='passwordmessage' class="error_message"></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php echo "确认密码" ;?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.password1',array("maxlength"=>"50","autocomplete"=>"off",'type' => 'password'));?></div>
                <div id='passwordmessage1' class="error_message"></div>
            </div>
        </div>
        <?php if($cuser['isadmin']){?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Group")?>：</div>
                <div class="form_right_e_input left">
                <?php	echo $form->select('User.groupid',$grouplist,null,null,null);      ?>
                </div>
            </div>
        </div>
        <?php 
        		}else{
					echo $form->text('User.groupid',array("maxlength"=>"50","autocomplete"=>"off","value"=>$cuser['groupid'],'readonly'=>'true','type'=>'hidden'));
				}?>
        
        
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_right_e_input left"><?php echo $form->checkbox('User.isgroupadmin');?><?php __("模块管理员")?></div>
            </div>
        </div>
        
        
        
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Position")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.position',array("maxlength"=>"20"));?></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Tel")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.mobile',array("maxlength"=>"30"));?></div>
            </div>
        </div>
         
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Address")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->text('User.address',array("maxlength"=>"200"));?></div>
            </div>
        </div>
        <?php if($cuser['isadmin']){ ?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_right_e_input left"><?php echo $form->checkbox('User.isadmin');?><?php __("系统管理员")?></div>
            </div>
        </div>
       	<div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_right_e_input left"><?php echo $form->checkbox('User.isvisitor');?><?php __("高级访客")?></div>
            </div>
        </div>      
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_right_e_input left"><?php echo $form->checkbox('User.can_updata');?><?php __("同步数据权限")?></div>
            </div>
        </div>        
        <?php }?>
        
        <?php echo $form->hidden('User.photo_id');?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_add_submit left">
                    <?php echo $form->submit(__('Save',true), array("id"=>"adduser","name"=>"submit","class"=>"buttom","div"=>false));  ?>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
var webpath=$("#getpath").attr('href');
$(document).ready(function() {
    $("#UserEmail").blur(function() {  
        var mail=this.value;
        var umail=$("#UserUemail").val();
        checkuserbymail(webpath,mail,umail,"#mailmessage");
    }); 
});
function addcheckinfo(){
    if($("#UserName").val().trim() == ''){
        $("#namemessage").html('请填写昵称');
        return false;
      }else{
         $("#namemessage").html('');
      }
      if($("#UserPassword").val().trim() == ''){
            $("#passwordmessage").html('请填写密码！');
            return false;
      }else if($("#UserPassword").val().length < 6){
            $("#passwordmessage").html('密码至少6位！');
            return false;
      }else if($("#UserPassword").val().length > 32){
            $("#passwordmessage").html('密码不能超过32位！');
            return false;
       }else{
        $("#passwordmessage").html('');
       }
       if($("#UserPassword1").val().trim() == ''){
            $("#passwordmessage1").html('请填写确认密码！');
            return false;
      }else if($("#UserPassword1").val().length < 6){
            $("#passwordmessage1").html('确认密码至少6位！');
            return false;
      }else if($("#UserPassword1").val().length > 32){
            $("#passwordmessage1").html('确认密码不能超过32位！');
            return false;
       }else if($("#UserPassword1").val().trim() != $("#UserPassword").val().trim()){
             $("#passwordmessage1").html('输入的密码不匹配！');
            return false;
       }else{
        $("#passwordmessage1").html('');
       }
       
       if($("#mailmessage").css('display')=="block")
        {
            return false;
        }
       return true;
}
</script>